#！/usr/bin/env python
#coding:utf-8
data = [1,3,6,7,9,12,14,16,17,18,20,21,22,23,30,32,33,35]
def binary_search(dataset,find_num):
    print(dataset)
    if len(dataset) >1:
        mid = int(len(dataset)/2)
        if dataset[mid] == find_num:
            print('找到要的数字',dataset[mid])
        elif dataset[mid] > find_num:
            print('要找的数字在%s左边'%dataset[mid])
            return binary_search(dataset[0:mid],find_num)
        else:
            print('要找的数字在%s的右边'%dataset[mid])
            return binary_search(dataset[mid:], find_num)
    else:
        if dataset[0] == find_num:
            print('要找的数字是：',dataset[0])
        else:
            print('要找的数字不在列表里')

binary_search(data,33)
